using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class PriceTypeAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public PriceTypeAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"AP","DC","IC","PF","TF","TP","UP"};
						validVersionCodes[HL7Version.v231] = new string[]{"AP","PF","UP","TF","DC","IC","TP"};
						validVersionCodes[HL7Version.v24] = new string[]{"AP","DC","IC","PF","TF","TP","UP"};
						validVersionCodes[HL7Version.v25] = new string[]{"AP","DC","IC","PF","TF","TP","UP"};
						validVersionCodes[HL7Version.v251] = new string[]{"AP","DC","IC","PF","TF","TP","UP"};
						validVersionCodes[HL7Version.v26] = new string[]{"AP","DC","IC","PF","TF","TP","UP"};
						validVersionCodes[HL7Version.v27] = new string[]{"AP","DC","IC","PF","TF","TP","UP"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Administrative Price or Handling Fee","Direct Unit Cost","Indirect Unit Cost","Professional Fee for Performing Provider","Technology Fee for Use of Equipment","Total Price","Unit Price, may be based on length of procedure or service"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"administrative price or handling fee","professional fee for performing provider","unit price, may be based on length of procedure or service","technology fee for use of equipment","direct unit cost","indirect unit cost","total price"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"administrative price or handling fee","direct unit cost","indirect unit cost","professional fee for performing provider","technology fee for use of equipment","total price","unit price, may be based on length of procedure or service"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"administrative price or handling fee","direct unit cost","indirect unit cost","professional fee for performing provider","technology fee for use of equipment","total price","unit price, may be based on length of procedure or service"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"administrative price or handling fee","direct unit cost","indirect unit cost","professional fee for performing provider","technology fee for use of equipment","total price","unit price, may be based on length of procedure or service"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"administrative price or handling fee","direct unit cost","indirect unit cost","professional fee for performing provider","technology fee for use of equipment","total price","unit price, may be based on length of procedure or service"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"administrative price or handling fee","direct unit cost","indirect unit cost","professional fee for performing provider","technology fee for use of equipment","total price","unit price, may be based on length of procedure or service"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
